<template>
	<view class="page">
		<image src="/static/image/xm-bg.png" class="bg-color" mode="aspectFill"></image>
		<z-paging ref="paging" @scroll="onPagingScroll" refresher-only @onRefresh="onRefresh"
			:refresher-theme-style="'white'">
			<template slot="top">
				<view id="navbar">
					<uv-navbar :bgColor="scrollTopVal > 30 ? '#ffffff' : 'rgba(0,0,0,0)'" autoBack :fixed="true" placeholder
						:leftIconColor="scrollTopVal > 30 ? '#000000' : '#ffffff'"
						:titleStyle="scrollTopVal > 30 ? 'color:#000000;' : 'color:#ffffff;'" title="项目详情"></uv-navbar>
				</view>
			</template>
			<view class="contnet-box">
				<view class="data-box">
					<text class="title" user-select>{{project_info.project_name}}</text>
					<view class="label-box">
						<block>
							<!-- colors: ["#60cf23", "#e8a35a", "#bccf2d", "#4F0CCA", "#D88D95", "#8F279B", "#7D365D", "#1acfd6", "#0078A3",
															"#A71B1B", "#175ADC",], -->
							<uv-tags text="待启动" size="mini" bgColor="#175ADC33" color="#175ADC" borderColor="rgba(0,0,0,0)"
								v-if="project_info.display_status == 10"></uv-tags>
							<uv-tags text="待勘场" size="mini" bgColor="#e8a35a33" color="#e8a35a" borderColor="rgba(0,0,0,0)"
								v-if="project_info.display_status == 15"></uv-tags>
							<uv-tags text="待勘场出图" size="mini" bgColor="#bccf2d33" color="#bccf2d" borderColor="rgba(0,0,0,0)"
								v-if="project_info.display_status == 18"></uv-tags>
							<uv-tags text="待方案设计" size="mini" bgColor="#4F0CCA33" color="#4F0CCA" borderColor="rgba(0,0,0,0)"
								v-if="project_info.display_status == 20"></uv-tags>
							<uv-tags text="待报价" size="mini" bgColor="#D88D9533" color="#D88D95" borderColor="rgba(0,0,0,0)"
								v-if="project_info.display_status == 25"></uv-tags>
							<uv-tags text="洽谈中" size="mini" bgColor="#8F279B33" color="#8F279B" borderColor="rgba(0,0,0,0)"
								v-if="project_info.display_status == 30"></uv-tags>
							<uv-tags text="已签约" size="mini" bgColor="#7D365D33" color="#7D365D" borderColor="rgba(0,0,0,0)"
								v-if="project_info.display_status == 40"></uv-tags>
							<uv-tags text="待进场" size="mini" bgColor="#2b821633" color="#2b8216" borderColor="rgba(0,0,0,0)"
								v-if="project_info.display_status == 42"></uv-tags>
							<uv-tags text="施工中" size="mini" bgColor="#1acfd633" color="#1acfd6" borderColor="rgba(0,0,0,0)"
								v-if="project_info.display_status == 45"></uv-tags>
							<uv-tags text="已完工" size="mini" bgColor="#0078A333" color="#0078A3" borderColor="rgba(0,0,0,0)"
								v-if="project_info.display_status == 50"></uv-tags>
							<uv-tags text="待结算" size="mini" bgColor="#A71B1B33" color="#A71B1B" borderColor="rgba(0,0,0,0)"
								v-if="project_info.display_status == 55"></uv-tags>
							<uv-tags text="项目完结" size="mini" bgColor="#60cf2333" color="#60cf23" borderColor="rgba(0,0,0,0)"
								v-if="project_info.display_status == 60"></uv-tags>
							<uv-tags text="项目取消" size="mini" bgColor="#f4f4f5" color="#909399" borderColor="rgba(0,0,0,0)"
								v-if="project_info.display_status == 70"></uv-tags>
						</block>
						<uv-tags :text="project_info.brand_name" v-if="project_info.brand_name" size="mini"
							:bgColor="`${project_info.brand_colour}33`" :color="project_info.brand_colour"
							borderColor="rgba(0,0,0,0)"></uv-tags>

						<uv-tags text="无需勘场" size="mini" bgColor="#F4F4F5" color="#909399" borderColor="rgba(0,0,0,0)"
							v-if="project_info.survey_site == 1"></uv-tags>
						<uv-tags text="实地勘场" size="mini" bgColor="rgba(59,117,255,.15)" color="#3B75FF" borderColor="rgba(0,0,0,0)"
							v-if="project_info.survey_site == 2"></uv-tags>
						<uv-tags text="勘场出图" size="mini" bgColor="rgba(59,117,255,.15)" color="#3B75FF" borderColor="rgba(0,0,0,0)"
							v-if="project_info.survey_site == 3"></uv-tags>
					</view>
					<view class="flex-box">
						<view class="object-box-item" style="width: 300rpx">
							<view class="object-box-item-title">编号</view>
							<view class="object-box-item-desc" @click="copy(project_info.project_number)">
								{{project_info.project_number || ''}}
								<view class="iconfont icon-ic_line_copy24px"></view>
							</view>
						</view>
						<view class="object-box-item">
							<view class="object-box-item-title">类型</view>
							<text class="object-box-item-desc" user-select>{{project_info.store_type_name || '--'}}</text>
						</view>
					</view>
					<view class="object-box-item">
						<view class="object-box-item-title">地址</view>
						<text class="object-box-item-desc" user-select>{{project_info.area + project_info.address || ''}}</text>
					</view>
				</view>
				<view class="scroll-view-box" :style="{minHeight: `calc(100vh - ${navbarHeight + bottomHeight}px - 360rpx)`}">
					<uv-tabs lineColor="#477DFF" :activeStyle="{ color: '#3B75FF' }" :inactiveStyle="{ color: '#1B2431' }"
						:itemStyle="{height: '33px'}" :list="typeList" @click="typeClickFunc" :scrollable="false"
						:current="typeCurrentIndex"></uv-tabs>
					<!-- 项目信息 -->
					<view class="box-box" v-if="typeCurrentIndex == 0">
						<view class="tab-box">
							<uv-tabs lineColor="rgba(0,0,0,0)" :activeStyle="{
										width: '136rpx',
										height: '58rpx',
										background: '#477DFF',
										borderRadius: '12rpx',
										lineHeight: '58rpx',
										textAlign: 'center',
										fontWeight: '400',
										fontSize: '24rpx',
										color: '#FFFFFF'
									}" :inactiveStyle="{
										width: '136rpx',
										height: '58rpx',
										background: '#FFFFFF',
										borderRadius: '12rpx',
										lineHeight: '58rpx',
										textAlign: 'center',
										fontWeight: '400',
										fontSize: '24rpx',
										color: '#1B2431'
									}" :itemStyle="{ padding: '0 5px' }" :list="tabList" @click="tabClickFunc" :scrollable="true"
								:current="tabCurrentIndex"></uv-tabs>
						</view>
						<!-- 人员信息 -->
						<view class="tab-item-box" v-if="tabCurrentIndex == 0 && !loading">
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">客户经理</view>
								<view v-if="info.account_manager_id" class="tab-item-box-item-right-box"
									@click="call(info.account_manager_phone)">
									<image :src="info.account_manager_image" mode="aspectFill" class="tab-item-box-item-right-box-avater">
									</image>
									<view class="tab-item-box-item-right-box-name">{{info.account_manager_name}}</view>
									<text class="iconfont icon-dianhua"></text>
								</view>
								<view v-else class="tab-item-box-item-right-box">
									<view class="tab-item-box-item-right-box-name">--</view>
								</view>
							</view>
							<view class="tab-item-box-item" v-if="project_info.survey_site == 2">
								<view class="tab-item-box-item-title">勘场-工程经理</view>
								<view v-if="info.site_surveyors_id" class="tab-item-box-item-right-box"
									@click="call(info.site_surveyors_phone)">
									<image :src="info.site_surveyors_image" mode="aspectFill" class="tab-item-box-item-right-box-avater">
									</image>
									<view class="tab-item-box-item-right-box-name">{{info.site_surveyors_name}}</view>
									<text class="iconfont icon-dianhua"></text>
								</view>
								<view v-else class="tab-item-box-item-right-box">
									<view class="tab-item-box-item-right-box-name">--</view>
								</view>
							</view>
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">施工-工程经理</view>
								<view v-if="info.engineering_manager_id" class="tab-item-box-item-right-box"
									@click="call(info.engineering_manager_phone)">
									<image :src="info.engineering_manager_image" mode="aspectFill"
										class="tab-item-box-item-right-box-avater">
									</image>
									<view class="tab-item-box-item-right-box-name">{{info.engineering_manager_name}}</view>
									<text class="iconfont icon-dianhua"></text>
								</view>
								<view v-else class="tab-item-box-item-right-box">
									<view class="tab-item-box-item-right-box-name">--</view>
								</view>
							</view>
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">工程监理</view>
								<view v-if="info.engineering_supervision_id" class="tab-item-box-item-right-box"
									@click="call(info.engineering_supervision_phone)">
									<image :src="info.engineering_supervision_image" mode="aspectFill"
										class="tab-item-box-item-right-box-avater">
									</image>
									<view class="tab-item-box-item-right-box-name">{{info.engineering_supervision_name}}</view>
									<text class="iconfont icon-dianhua"></text>
								</view>
								<view v-else class="tab-item-box-item-right-box">
									<view class="tab-item-box-item-right-box-name">--</view>
								</view>
							</view>
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">项目创建时间</view>
								<view class="tab-item-box-item-right-box">
									<view class="tab-item-box-item-right-box-name">{{info.created_at}}</view>
								</view>
							</view>
						</view>
						<!-- 勘场信息 -->
						<view class="tab-item-box" v-if="tabCurrentIndex == 1 && !loading">
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">申请勘场日期</view>
								<view class="tab-item-box-item-right-box">
									<view class="tab-item-box-item-right-box-name">{{info.apply_survey_date || '--'}}</view>
								</view>
							</view>
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">约定勘场日期</view>
								<view class="tab-item-box-item-right-box">
									<view class="tab-item-box-item-right-box-name">{{info.survey_date || '--'}}</view>
								</view>
							</view>
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">实际勘场日期</view>
								<view class="tab-item-box-item-right-box">
									<view class="tab-item-box-item-right-box-name">{{info.actual_survey_date || '--'}}</view>
								</view>
							</view>
							<template v-if="project_info.survey_site == 2">
								<view class="tab-item-box-item">
									<view class="tab-item-box-item-title">现场图片</view>
									<view class="tab-item-box-item-right-box" v-if="info.scene_file">
										<view class="file-box" v-if="info.scene_file.length != 0">
											<image class="file-img" v-for="(item, idx) in info.scene_file" :key="idx" :src="fileImg(item)"
												mode="aspectFill" @click="preview(item)"></image>
										</view>
										<view v-else class="tab-item-box-item-right-box-name">--</view>
									</view>
								</view>
								<view class="tab-item-box-item">
									<view class="tab-item-box-item-title">手绘图</view>
									<view class="tab-item-box-item-right-box" v-if="info.sketch_file">
										<view class="file-box" v-if="info.sketch_file.length != 0">
											<image class="file-img" v-for="(item, idx) in info.sketch_file" :key="idx" :src="fileImg(item)"
												mode="aspectFill" @click="preview(item)"></image>
										</view>
										<view v-else class="tab-item-box-item-right-box-name">--</view>
									</view>
								</view>
								<view class="tab-item-box-item">
									<view class="tab-item-box-item-title">现场视频</view>
									<view class="tab-item-box-item-right-box" v-if="info.video_file">
										<view class="file-box" v-if="info.video_file.length != 0">
											<image class="file-img" v-for="(item, idx) in info.video_file" :key="idx" :src="fileImg(item)"
												mode="aspectFill" @click="preview(item)"></image>
										</view>
										<view v-else class="tab-item-box-item-right-box-name">--</view>
									</view>
								</view>
								<view class="tab-item-box-item">
									<view class="tab-item-box-item-title">勘场报告</view>
									<view class="tab-item-box-item-right-box" v-if="info.report_file">
										<view class="file-box" v-if="info.report_file.length != 0">
											<image class="file-img" v-for="(item, idx) in info.report_file" :key="idx" :src="fileImg(item)"
												mode="aspectFill" @click="preview(item)"></image>
										</view>
										<view v-else class="tab-item-box-item-right-box-name">--</view>
									</view>
								</view>
							</template>
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">勘场资料</view>
								<view class="tab-item-box-item-right-box wrap" v-if="info.survey_data">
									<template v-if="info.survey_data.length != 0">
										<view class="tab-item-box-item-right-box-file" v-for="(item, idx) in info.survey_data" :key="idx"
											@click="preview(item)">
											{{item.file_name}}
										</view>
									</template>
									<view v-else class="tab-item-box-item-right-box-name">--</view>
									<!-- 	<view class="file-box" v-if="info.survey_data.length != 0">
										<image class="file-img" v-for="(item, idx) in info.survey_data" :key="idx" :src="fileImg(item)"
											mode="aspectFill" @click="preview(item)"></image>
									</view>
									<view v-else class="tab-item-box-item-right-box-name">--</view> -->
								</view>
							</view>
						</view>
						<!-- 图纸信息 -->
						<view class="tab-item-box" v-if="tabCurrentIndex == 2 && !loading">
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">平面图</view>
								<view class="tab-item-box-item-right-box" v-if="info.DesignDrawings">
									<view class="file-box" v-if="info.DesignDrawings.plan_drawing.length != 0">
										<image class="file-img" v-for="(item, idx) in info.DesignDrawings.plan_drawing" :key="idx"
											:src="fileImg(item)" mode="aspectFill" @click="preview(item)"></image>
									</view>
									<view v-else class="tab-item-box-item-right-box-name">--</view>
								</view>
							</view>
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">效果图</view>
								<view class="tab-item-box-item-right-box" v-if="info.DesignDrawings">
									<view class="file-box" v-if="info.DesignDrawings.effect_drawing.length != 0">
										<image class="file-img" v-for="(item, idx) in info.DesignDrawings.effect_drawing" :key="idx"
											:src="fileImg(item)" mode="aspectFill" @click="preview(item)"></image>
									</view>
									<view v-else class="tab-item-box-item-right-box-name">--</view>
								</view>
							</view>
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">施工/深化图</view>
								<view class="tab-item-box-item-right-box" v-if="info.DesignDrawings">
									<view class="file-box" v-if="info.DesignDrawings.construction_drawing.length != 0">
										<image class="file-img" v-for="(item, idx) in info.DesignDrawings.construction_drawing" :key="idx"
											:src="fileImg(item)" mode="aspectFill" @click="preview(item)"></image>
									</view>
									<view v-else class="tab-item-box-item-right-box-name">--</view>
								</view>
							</view>
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">其他文件</view>
								<view class="tab-item-box-item-right-box" v-if="info.DesignDrawings">
									<view class="file-box" v-if="info.DesignDrawings.other_file.length != 0">
										<image class="file-img" v-for="(item, idx) in info.DesignDrawings.other_file" :key="idx"
											:src="fileImg(item)" mode="aspectFill" @click="preview(item)"></image>
									</view>
									<view v-else class="tab-item-box-item-right-box-name">--</view>
								</view>
							</view>
						</view>
						<!-- 报价信息 -->
						<view class="tab-item-box" v-if="tabCurrentIndex == 3 && !loading && JSON.stringify(info) != '{}'">
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">报价时间</view>
								<view class="tab-item-box-item-right-box">
									<view class="tab-item-box-item-right-box-name">
										{{info.to_customer_quotation_date}}
									</view>
								</view>
							</view>
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">项目面积</view>
								<view class="tab-item-box-item-right-box">
									<view class="tab-item-box-item-right-box-name">
										{{info.building_area != '' ? `${info.building_area}㎡` : '--' }}
									</view>
								</view>
							</view>
							<view class="tab-item-box-item" style="border-bottom: none;">
								<view class="tab-item-box-item-title">报价金额</view>
								<view class="tab-item-box-item-right-box" v-if="info.quotation_amount != ''" @click="bjOpen = !bjOpen">
									<view class="tab-item-box-item-right-box-name">{{info.quotation_amount}}元</view>
									<uv-icon :name="bjOpen ? 'arrow-up' : 'arrow-down'" size="24rpx"></uv-icon>
								</view>
								<view class="tab-item-box-item-right-box" v-else>
									<view class="tab-item-box-item-right-box-name">--</view>
								</view>
							</view>
							<view class="bj-child-box" v-if="bjOpen && info.quotation_amount != ''">
								<view class="bj-cell">
									<view class="bj-label">基础装修费</view>
									<view class="bj-desc">
										{{info.basic_decoration_fee != '' || info.basic_decoration_fee === 0 ? `${info.basic_decoration_fee}元` : '--' }}
									</view>
								</view>
								<view class="bj-cell">
									<view class="bj-label">主材采购费</view>
									<view class="bj-desc">
										{{info.material_costs != '' || info.material_costs === 0 ? `${info.material_costs}元` : '--' }}
									</view>
								</view>
								<view class="bj-cell">
									<view class="bj-label">税金</view>
									<view class="bj-desc">
										{{info.quotation_taxes != '' || info.quotation_taxes === 0 ? `${info.quotation_taxes}元` : '--' }}
									</view>
								</view>
							</view>
							<view class="tab-item-box-item" style="border-top: solid 1rpx #ebf3f8;">
								<view class="tab-item-box-item-title">报价单</view>
								<view class="tab-item-box-item-right-box wrap" v-if="info.quotation_file">
									<template v-if="info.quotation_file.length != 0">
										<view class="tab-item-box-item-right-box-file" v-for="(item, idx) in info.quotation_file" :key="idx"
											@click="preview(item)">
											{{item.file_name}}
										</view>
									</template>
									<view v-else class="tab-item-box-item-right-box-name">--</view>
								</view>
							</view>
						</view>
						<!-- 增减项 -->
						<view class="tab-item-box" v-if="tabCurrentIndex == 4 && !loading"
							style="background-color: #f8f8f8; padding: 0">
							<view class="empty-box" v-if="info.length == 0">
								<image class="empty-img" src="@/static/image/nulldata.png" mode="aspectFill"></image>
								<view class="empty-desc">暂无增减项</view>
							</view>
							<view class="zjx-item" v-for="(item, idx) in info" :key="idx">
								<view class="zjx-cell">
									<view class="zjx-label">增减项金额</view>
									<view class="zjx-desc flex" @click="item.zjxOpen = !item.zjxOpen">
										<span style="margin-right: 10rpx;">{{convert_val(item, item.change_amount)}}</span>
										<uv-icon :name="item.zjxOpen ? 'arrow-up' : 'arrow-down'" size="24rpx"></uv-icon>
									</view>
								</view>
								<view class="child-box" v-if="item.zjxOpen">
									<view class="zjx-cell">
										<view class="zjx-label">基础装修费</view>
										<view class="zjx-desc">
											{{convert_val(item, item.basic_decoration_fee)}}
										</view>
									</view>
									<view class="zjx-cell">
										<view class="zjx-label">主材采购费</view>
										<view class="zjx-desc">
											{{convert_val(item, item.material_costs)}}
										</view>
									</view>
									<view class="zjx-cell">
										<view class="zjx-label">税金</view>
										<view class="zjx-desc">
											{{convert_val(item, item.quotation_taxes)}}
										</view>
									</view>
								</view>
								<view class="zjx-cell">
									<view class="zjx-label">增减类型</view>
									<view class="zjx-desc">{{item.increase_or_decrease == 1 ? '增项' : '减项'}}</view>
								</view>
								<view class="zjx-cell">
									<view class="zjx-label">优惠金额</view>
									<view class="zjx-desc">
										{{convert_val(item, item.discount_amount)}}
									</view>
								</view>
								<view class="zjx-cell">
									<view class="zjx-label">报价附件</view>
									<template v-if="item.project_quotation_file && item.project_quotation_file.length != 0">
										<view class="zjx-desc link" v-for="(row, index) in item.project_quotation_file" :key="index"
											@click="preview(row)">
											{{row.file_name}}
										</view>
									</template>
									<view v-else class="zjx-desc">--</view>
								</view>
								<view class="zjx-cell">
									<view class="zjx-label">报价时间</view>
									<view class="zjx-desc">{{item.created_at}}</view>
								</view>
							</view>
						</view>
						<!-- 合同信息 -->
						<view class="tab-item-box" v-if="tabCurrentIndex == 5 && !loading"
							style="background-color: #f8f8f8; padding: 0">
							<!-- v-for="(item, index) in info.list" :key="index" -->
							<view class="empty-box" v-if="info.length == 0">
								<image class="empty-img" src="@/static/image/nulldata.png" mode="aspectFill"></image>
								<view class="empty-desc">暂无合同</view>
							</view>

							<view class="sgjl-item" v-for="(item, index) in info" :key="index">
								<view class="sgjl-content-box">
									<view class="content-item">
										<view class="label">合同类型</view>
										<view class="desc" v-if="item.contract_type == 1">施工合同</view>
										<view class="desc" v-if="item.contract_type == 2">勘场合同</view>
										<view class="desc" v-if="item.contract_type == 3">增减项合同</view>
										<view class="desc" v-if="item.contract_type == 4">定金合同</view>
									</view>
									<view class="content-item">
										<view class="label">合同编号</view>
										<view class="desc">{{item.contract_number}}</view>
									</view>
									<view class="content-item" v-if="item.ht_type > 2">
										<view class="label">开工日期</view>
										<view class="desc">{{item.contract_commencement_date}}</view>
									</view>
									<view class="content-item" v-if="item.ht_type > 2">
										<view class="label">完工日期</view>
										<view class="desc">{{item.contract_completion_date || '--'}}</view>
									</view>
									<view class="content-item" v-if="item.ht_type > 2">
										<view class="label">工期</view>
										<view class="desc">{{item.contract_duration_days ? `${item.contract_duration_days}天` : '--'}}</view>
									</view>
									<view class="content-item">
										<view class="label">签约金额</view>
										<view class="desc">{{item.contract_price ? `${item.contract_price}元` : '--'}}</view>
									</view>
									<view class="content-item">
										<view class="label">合同附件</view>
										<view class="file-box">
											<view class="file-desc" v-for="(row, idx) in item.contract_files" :key="idx"
												@click="preview(row)">{{row.file_name}}
											</view>
										</view>
										<view class="desc" v-if="item.contract_files.length == 0">--</view>
									</view>
								</view>
							</view>
						</view>
						<!-- 付款详情 -->
						<view class="tab-item-box" v-if="tabCurrentIndex == 6 && !loading"
							style="background-color: #f8f8f8; padding: 0">
							<view class="payment-item2">
								<view class="row-cell">
									<view class="row-cell-label">开户行</view>
									<view class="row-cell-desc flex-between">
										<view class="title">{{info.payment_account.opening_bank || '--'}}</view>
										<view class="copy" @click="copyBank">
											<view class="iconfont icon-ic_line_copy24px"></view>一键复制
										</view>
									</view>
								</view>
								<view class="row-cell">
									<view class="row-cell-label">账户名称</view>
									<view class="row-cell-desc">{{info.payment_account.account_name || '--'}}</view>
								</view>
								<view class="row-cell">
									<view class="row-cell-label">银行账号</view>
									<view class="row-cell-desc">{{info.payment_account.account_number || '--'}}</view>
								</view>
							</view>
							<template v-if="info.payment_account">
								<view class="payment-item" v-for="(item, index) in info.payment_account.list" :key="index">
									<view class="image-box" @click="multiple_preview(item.voucher_file)">
										<image :src="item.voucher_file[0].file_url" mode="aspectFill"></image>
										<view class="more" v-if="item.voucher_file.length > 1">
											<span style="line-height: 22rpx;height: 30rpx;">+</span> {{item.voucher_file.length}}
										</view>
									</view>
									<view class="payment-content-box">
										<view class="content-item">
											<view class="label">收款类型</view>
											<view class="desc">
												<template v-if="item.payment_type == 1">勘场费用</template>
												<template v-if="item.payment_type == 2">预付款</template>
												<template v-if="item.payment_type == 3">进度款</template>
												<template v-if="item.payment_type == 4">尾款</template>
												<template v-if="item.payment_type == 5">增项款</template>
												<template v-if="item.payment_type == 6">定金</template>
											</view>
										</view>
										<view class="content-item">
											<view class="label">收款金额</view>
											<view class="desc">{{item.amount_collected}}元</view>
										</view>
										<view class="content-item">
											<view class="label">收款时间</view>
											<view class="desc">{{item.created_at}}</view>
										</view>
									</view>
									<view class="payment-state">
										<img v-if="item.review_status == 1"
											src="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/dqr.png" />
										<img v-if="item.review_status == 2"
											src="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/ysk.png" />
										<!-- <uv-tags text="待收款" v-if="item.review_status == 1" size="mini" borderColor="#FFF3E9"
											bgColor="#FFF3E9" color="#FF9558" plain plainFill></uv-tags>
										<uv-tags text="已收款" v-if="item.review_status == 2" size="mini" borderColor="#E6EDFF"
											bgColor="#E6EDFF" color="#3B75FF" plain plainFill></uv-tags> -->
									</view>
								</view>


							</template>
						</view>
						<!-- 项目评分 -->
						<view class="tab-item-box" v-if="tabCurrentIndex == 7 && !loading"
							:style="info.evaluation_content[0].score == 0 || !info.evaluation_content ? 'background-color: #f8f8f8; padding: 0' : ''">
							<view class="empty-box" v-if="!info.evaluation_content || info.evaluation_content[0].score == 0">
								<image class="empty-img" src="@/static/image/nulldata.png" mode="aspectFill"></image>
								<view class="empty-desc">暂时无评价</view>
							</view>
							<view class="score-item" v-else>
								<view class="score-cell" v-for="(item, idx) in info.evaluation_content" :key="idx">
									<view class="score-label">{{item.name}}</view>
									<view class="score-desc">
										<uv-rate :value="item.score" active-color="#F7A059" inactiveIcon="star-fill" inactiveColor="#d5d4dc"
											readonly></uv-rate>
									</view>
								</view>
							</view>
						</view>
					</view>
					<!-- 施工信息 -->
					<view class="box-box" v-if="typeCurrentIndex == 1 ">
						<view class="tab-box">
							<uv-tabs lineColor="rgba(0,0,0,0)" :activeStyle="{
										width: '136rpx',
										height: '58rpx',
										background: '#477DFF',
										borderRadius: '12rpx',
										lineHeight: '58rpx',
										textAlign: 'center',
										fontWeight: '400',
										fontSize: '24rpx',
										color: '#FFFFFF'
									}" :inactiveStyle="{
										width: '136rpx',
										height: '58rpx',
										background: '#FFFFFF',
										borderRadius: '12rpx',
										lineHeight: '58rpx',
										textAlign: 'center',
										fontWeight: '400',
										fontSize: '24rpx',
										color: '#1B2431'
									}" :itemStyle="{ padding: '0 5px' }" :list="sgTabList" @click="tabClickFunc" :scrollable="true"
								:current="tabCurrentIndex"></uv-tabs>
						</view>
						<!-- 施工记录 -->
						<view class="tab-item-box" v-if="tabCurrentIndex == 0 && !loading"
							style="background-color: #f8f8f8; padding: 0">
							<view class="empty-box" v-if="info.list && info.list.length == 0">
								<image class="empty-img" src="@/static/image/nulldata.png" mode="aspectFill"></image>
								<view class="empty-desc">暂无施工记录</view>
							</view>

							<view class="sgjl-item" v-for="(item, index) in info.list" :key="index">
								<view class="sgjl-content-box">
									<view class="content-item">
										<view class="label">施工阶段</view>
										<view class="desc">{{item.construction_stage || '--'}}</view>
									</view>
									<view class="content-item">
										<view class="label">施工内容</view>
										<view class="desc">{{item.content || '--'}}</view>
									</view>
									<view class="content-item">
										<view class="label">其他说明</view>
										<view class="desc">{{item.remark || '--'}}</view>
									</view>
									<view class="content-item">
										<view class="label">创建时间</view>
										<view class="desc">{{item.created_at || '--'}}</view>
									</view>
									<view class="content-item" v-if="item.construction_files.length == 0">
										<view class="label" style="width: auto;">现场照片/视频</view>
										<view class="desc">--</view>
									</view>
									<view class="content-item2" v-else>
										<view class="label">现场照片/视频</view>
										<view class="file-box">
											<image class="file-img" v-for="(item, idx) in item.construction_files" :key="idx"
												:src="fileImg(item)" mode="aspectFill" @click="preview(item)"></image>
										</view>
									</view>
								</view>
							</view>
						</view>
						<!-- 工程验收 -->
						<view class="tab-item-box" v-if="tabCurrentIndex == 1 && !loading"
							style="background-color: #f8f8f8; padding: 0">
							<view class="empty-box" v-if="info.length == 0">
								<image class="empty-img" src="@/static/image/nulldata.png" mode="aspectFill"></image>
								<view class="empty-desc">无完成的工程验收</view>
							</view>

							<view class="gcys-box" v-for="(item, idx) in info" :key="idx">
								<view class="title-box">
									<view class="gcys-title">{{idx + 1}}.{{item.node_name}}</view>
									<uv-tags text="已验收" size="mini" borderColor="rgba(0,0,0,0)" color="#3B75FF" bgColor="#3B75FF33" plain
										plainFill></uv-tags>
								</view>
								<view class="gcys-cell" v-for="(row, index) in item.children" :key="index">
									<view class="gcys-label">{{row.node_name}}</view>
									<view class="gcys-desc" v-if="row.content_type == 1">{{row.content || '--'}}</view>
									<view class="gcys-file" v-if="row.content_type == 2">
										<image class="file-img" mode="aspectFill" v-for="(file, idx2) in row.node_files" :key="idx2"
											:src="fileImg(file)" @click="preview(file)"></image>
										<span class="null-desc" v-if="row.node_files.length == 0">--</span>
									</view>
								</view>
							</view>
						</view>
						<!-- 维保信息 -->
						<view class="tab-item-box" v-if="tabCurrentIndex == 2 && !loading">
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">质保开始日期</view>
								<view class="tab-item-box-item-right-box">
									<view class="tab-item-box-item-right-box-name">{{info.warranty_deadline_state_date || '--'}}</view>
								</view>
							</view>
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">质保截止日期</view>
								<view class="tab-item-box-item-right-box">
									<view class="tab-item-box-item-right-box-name">{{info.warranty_deadline_end_date || '--'}}</view>
								</view>
							</view>
							<view class="tab-item-box-item">
								<view class="tab-item-box-item-title">是否保质期内</view>
								<view class="tab-item-box-item-right-box" v-if="info.warranty_deadline_end_date">
									<view class="tab-item-box-item-right-box-name" v-if="info.is_sell_by == 1">是</view>
									<view class="tab-item-box-item-right-box-name" v-else-if="info.is_sell_by == 2">否</view>
								</view>
								<view class="tab-item-box-item-right-box" v-else>
									<view class="tab-item-box-item-right-box-name">--</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<template slot="bottom">
				<view class="bottom-box ios" id="bottom"
					v-if="((project_info.status == 1015 || project_info.status >= 1060) && project_info.status < 1090) && tabCurrentIndex == 2">
					<view class="tips">操作</view>
					<view class="btns">
						<uv-button @click="scsjtShow = true" customTextStyle="font-weight: 400;font-size: 28rpx;color: #FFFFFF;"
							customStyle="width: 190rpx;height: 80rpx;background: #3B75FF;border-radius: 16rpx;" type="primary"
							text="上传设计图"></uv-button>
					</view>
				</view>
			</template>
			<template slot="bottom">
				<view class="bottom-box ios" id="bottom" v-if="project_info.status == 1150 && tabCurrentIndex == 7">
					<view class="tips">操作</view>
					<view class="btns">
						<uv-button @click="khxmpjShow = true" customTextStyle="font-weight: 400;font-size: 28rpx;color: #FFFFFF;"
							customStyle="width: 180rpx;height: 80rpx;background: #3B75FF;border-radius: 16rpx;" type="primary"
							text="项目评价"></uv-button>
					</view>
				</view>
			</template>

			<view class="bg"></view>
		</z-paging>
		<!-- 上传设计图 -->
		<scsjtCom :show="scsjtShow" @close="scsjtShow = false" @lazy="onRefresh" :project_info="project_info"></scsjtCom>
		<!-- 客户项目评价 -->
		<khxmpjCom :show="khxmpjShow" @close="khxmpjShow = false" @lazy="onRefresh" :project_id="project_info.id">
		</khxmpjCom>
		<!-- 文件预览 -->
		<preFileCom :fileObj="fileObj" @onFileSuccess="fileObj=''"></preFileCom>
	</view>
</template>

<script>
	import {
		fileImgFunc
	} from '@/utils/utils.js'

	export default {
		data() {
			return {
				navbarHeight: 88,
				bottomHeight: 0,
				// 报价查看子级
				bjOpen: false,
				// 项目信息
				project_info: {},
				// 各tab中的信息
				info: {},
				loading: true,
				// 滚动条位置
				scrollTopVal: '',
				// 项目信息/施工信息
				tabCurrentIndex: 0,
				// 子类索引
				typeCurrentIndex: 0,
				typeList: [{
						name: '项目信息',
						id: 1
					},
					{
						name: '施工信息',
						id: 2
					}
				],
				tabList: [{
						name: '人员信息',
						id: 1
					},
					{
						name: '勘场信息',
						id: 2,
					},
					{
						name: '图纸信息',
						id: 3
					},
					{
						name: '报价信息',
						id: 4
					},
					{
						name: '增减项信息',
						id: 8
					},
					{
						name: '合同信息',
						id: 5
					},
					{
						name: '付款详情',
						id: 6
					},
					{
						name: '项目评分',
						id: 9
					}
				],
				sgTabList: [{
						name: '施工记录',
						id: 1
					},
					{
						name: '工程验收',
						id: 2
					},
					{
						name: '维保信息',
						id: 3
					},
				],
				// 预览文件
				fileObj: null,

				khxmpjShow: false,
				scsjtShow: false,
			}
		},
		computed: {
			fileImg() {
				return item => {
					return fileImgFunc(item)
				}
			},
			// 判断是否需要显示负号
			convert_val() {
				return (item, val) => {
					if (item.increase_or_decrease == 1 || val == 0) {
						var price = val + '元'
					} else {
						var price = '-' + val + '元'
					}
					return price
				}
			},
		},
		onLoad(options) {
			if (options.sn) {
				this.project_id = options.sn
				this.getJCDetail()
				this.getDetail()
			} else {
				uni.navigateBack({
					delta: 1 // 默认值是1
				});
			}

			uni.createSelectorQuery().select("#navbar").boundingClientRect((rect) => {
				this.navbarHeight = rect.height
			}).exec()
		},
		methods: {
			// 滚动条位置监听
			onPagingScroll(e) {
				this.scrollTopVal = e.detail.scrollTop;
				if (e.detail.scrollTop > 30) {
					uni.setNavigationBarColor({
						frontColor: '#000000',
						backgroundColor: '#000000',
						animation: {
							duration: 400,
							timingFunc: 'easeIn'
						}
					});
				} else {
					uni.setNavigationBarColor({
						frontColor: '#ffffff',
						backgroundColor: '#ffffff',
						animation: {
							duration: 400,
							timingFunc: 'easeIn'
						}
					});
				}
			},
			// 子类change
			typeClickFunc(e) {
				if (this.typeCurrentIndex == e.index) return
				this.typeCurrentIndex = e.index;
				this.tabCurrentIndex = 0;
				if (e.index == 0) {
					this.getDetail();
				} else {
					this.getSGDetail();
				}
			},
			// 项目信息/施工信息change
			tabClickFunc(e) {
				console.log(e, 'ssssss');
				if (e.disabled) {
					return
				}
				if (this.tabCurrentIndex == e.index) return
				this.tabCurrentIndex = e.index;
				this.info = {};
				if (this.typeCurrentIndex == 0) {
					this.getDetail();
				} else {
					this.getSGDetail();
				}
			},
			// 预览
			preview(item) {
				this.fileObj = item
			},
			// 复制
			copy(value) {
				uni.setClipboardData({
					data: value,
					success: () => {
						uni.showToast({
							title: '复制成功',
							duration: 2000,
							icon: 'success'
						})
					}
				})
			},
			// 银行卡
			copyBank() {
				let info = this.info.payment_account
				uni.setClipboardData({
					data: `${info.opening_bank} \n${info.account_name} \n${info.account_number}`,
					success: () => {
						uni.showToast({
							title: '复制成功',
							duration: 2000,
							icon: 'success'
						})
					}
				})
			},
			// 多图预览
			multiple_preview(list) {
				let urls = list.map(item => item.file_url)
				uni.previewImage({
					urls
				});
			},
			// 打电话
			call(value) {
				uni.makePhoneCall({
					phoneNumber: value,
					success: () => {
						console.log('拨打电话成功');
					}
				})
			},
			// 下拉刷新
			onRefresh() {
				this.getJCDetail();
				if (this.typeCurrentIndex == 0) {
					this.getDetail();
				} else {
					this.getSGDetail();
				}
			},
			//----------------------获取数据--------------------
			// 基础详情
			getJCDetail() {
				uni.showLoading({
					mask: true,
					title: '加载中...'
				});
				this.$Api.khProjectDetails({
					project_id: this.project_id
				}).then(res => {
					console.log(res, '基础详情');
					if (res.code == 200) {
						if (res.data.survey_site == 1) {
							this.tabList[1].disabled = true;
						}
						this.project_info = res.data
					}
					uni.hideLoading();
					this.$refs.paging.complete();
				})
			},
			// 获取子类详情
			getDetail() {
				this.loading = true
				this.$Api.khGetProjectDetails({
					project_id: this.project_id,
					tab_type: this.tabList[this.tabCurrentIndex].id
				}).then(res => {
					console.log(res, '获取详情');
					if (res.code == 200) {
						// 报价
						if (this.tabCurrentIndex == 3) {
							this.bjOpen = true
						}
						// 增减项
						if (this.tabCurrentIndex == 4) {
							res.data.map(item => {
								item.zjxOpen = true
							})
						}
						// 合同
						if (this.tabCurrentIndex == 5) {
							res.data = res.data.list
						}
						console.log(res.data, '处理后');
						this.info = res.data
					}

					if (this.tabCurrentIndex == 2 || this.tabCurrentIndex == 7) {
						uni.createSelectorQuery().select("#bottom").boundingClientRect((rect) => {
							if (rect) {
								this.bottomHeight = rect.height
							}
						}).exec()
					} else {
						uni.createSelectorQuery().select("#navbar").boundingClientRect((rect) => {
							this.navbarHeight = rect.height
							this.bottomHeight = 0
						}).exec()
					}
					this.loading = false
				})
			},
			// 施工详情
			getSGDetail() {
				this.loading = true
				this.$Api.khGetConstructionDetails({
					project_id: this.project_id,
					tab_type: this.sgTabList[this.tabCurrentIndex].id
				}).then(res => {
					console.log(res, '获取施工详情');
					if (res.code == 200) {
						this.info = res.data
					}
					this.loading = false
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "index.scss";
</style>